package org.finesys.system.convert;

import org.finesys.system.api.entity.SysRole;
import org.finesys.system.api.vo.RoleExcelVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 角色转换
 */
@Mapper
public interface SysRoleConvert {

    SysRoleConvert INSTANCE = Mappers.getMapper(SysRoleConvert.class);

    /**
     * 转换 SysRole 为 RoleExcelVO 对象
     */
    @Mappings({
            @Mapping(target = "lineNum", ignore = true),
            @Mapping(target = "roleDesc", ignore = true),
            @Mapping(target = "tenantName", ignore = true)
    })
    RoleExcelVO convert(SysRole roleExcelVO);

    /**
     * 转换 roleExcelVO 为 SysRole 对象
     */


    @Mappings({
            @Mapping(target = "createBy", ignore = true),
            @Mapping(target = "updateBy", ignore = true),
            @Mapping(target = "createTime", ignore = true),
            @Mapping(target = "updateTime", ignore = true),
            @Mapping(target = "params", ignore = true),
            @Mapping(target = "delFlag", ignore = true),
            @Mapping(target = "dataScope", ignore = true),
            @Mapping(target = "dataScopeDeptIds", ignore = true),
            @Mapping(target = "remarks", ignore = true),
            @Mapping(target = "tenantId", ignore = true)
    })
    SysRole convert(RoleExcelVO roleExcelVO);

    /**
     * 数组转换
     */
    List<RoleExcelVO> convertList(List<SysRole> list);
}
